<?php

/**
 * This is the model class for table "prefix_notify_task".
 *
 * The followings are the available columns in table 'prefix_notify_task':
 * @property string $notify_task_id
 * @property string $user_login
 * @property string $user_mail
 * @property string $notify_subject
 * @property string $notify_text
 * @property string $date_created
 * @property integer $notify_task_status
 * @property User $user
 */
class NotifyTask extends LsActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return NotifyTask the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return Config::Get('db.table.notify_task');
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('notify_task_status', 'numerical', 'integerOnly'=>true),
			array('user_login', 'length', 'max'=>30),
			array('user_mail', 'length', 'max'=>50),
			array('notify_subject', 'length', 'max'=>200),
			array('notify_text, date_created', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('notify_task_id, user_login, user_mail, notify_subject, notify_text, date_created, notify_task_status', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'user' => array(self::BELONGS_TO, 'User', 'user_login'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'notify_task_id' => 'Notify Task',
			'user_login' => 'User Login',
			'user_mail' => 'User Mail',
			'notify_subject' => 'Notify Subject',
			'notify_text' => 'Notify Text',
			'date_created' => 'Date Created',
			'notify_task_status' => 'Notify Task Status',
		);
	}

}